<template>
	<n-upload
		:accept="props.accept"
		directory-dnd
		action="#"
		:max="1"
		:default-upload="false"
		@change="changeFile">
		<n-upload-dragger>
			<div style="margin-bottom: 12px">
				<n-icon size="48" :depth="3">
					<ArchiveIcon />
				</n-icon>
			</div>
			<n-text style="font-size: 16px">
				点击或者拖动文件到该区域来上传
			</n-text>
		</n-upload-dragger>
	</n-upload>
</template>
<script setup>
import ArchiveIcon from '@@/icons/archive'
const props = defineProps({
	changeFile: {
		required: true,
		type: Function,
		default: () => {}
	},
	accept: {
		type: String,
		default: '.xls,.xlsx'
	}
})
const changeFile = file => {
	if (file.event) {
		props.changeFile(file.file.file)
	}
}
</script>

<style scoped lang="scss">
</style>